package com.ss.android.article.browser.database;

import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.ss.android.article.browser.R;

import java.text.ParseException;

public final class BrowserHistory implements Comparable {
    @NonNull public String url;
    @NonNull public String title;
    @NonNull public String c;
    @Nullable public Bitmap d;
    public long time;
    public int icon;
    public int g;
    public boolean h;
    public String readableTime;

    public BrowserHistory() {
        this.url = "";
        this.title = "";
        this.c = "";
        this.d = null;
        this.time = 0;
        this.icon = 0;
        this.g = 0;
        this.h = false;
    }

    public BrowserHistory(@NonNull String arg5, @NonNull String arg6) {

        this.url = "";
        this.title = "";
        this.c = "";
        this.d = null;
        this.time = 0;
        this.icon = 0;
        this.g = 0;
        this.h = false;
        this.url = arg5;
        this.title = arg6;
        this.d = null;
        this.time = System.currentTimeMillis();
        this.readableTime = BrowserHistory.convert2ReadableTime(this.time);
    }

    public BrowserHistory(@NonNull String arg5, @NonNull String arg6, byte arg7) {

        this.url = "";
        this.title = "";
        this.c = "";
        this.d = null;
        this.time = 0;
        this.icon = 0;
        this.g = 0;
        this.h = false;
        this.url = arg5;
        this.title = arg6;
        this.d = null;
        this.icon = R.drawable.icon_search;
        this.time = System.currentTimeMillis();
        this.readableTime = BrowserHistory.convert2ReadableTime(this.time);
    }

    public static String convert2ReadableTime(long arg2) {
        String v0 = com.ss.android.article.browser.c.a.a(arg2);
        try {
            if(com.ss.android.article.browser.c.a.a(v0)) {
                return "今天";
            }

            if(!com.ss.android.article.browser.c.a.b(v0)) {
                return v0;
            }
            v0 = "昨天";
        }
        catch(ParseException v1) {
            v1.printStackTrace();
        }

        return v0;
    }

    public final void setUrl(@Nullable String url) {
        if(url == null) {
            url = "";
        }
        this.url = url;
    }

    public final void setTitle(@Nullable String title) {
        if(title == null) {
            title = "";
        }
        this.title = title;
    }

    public final void c(@Nullable String arg1) {
        if(arg1 == null) {
            arg1 = "";
        }

        this.c = arg1;
    }

    public final int compareTo(@NonNull Object arg3) {
        int v0 = this.title.compareToIgnoreCase(((BrowserHistory)arg3).title);
        if(v0 == 0) {
            v0 = this.url.compareTo(((BrowserHistory)arg3).url);
        }

        return v0;
    }

    public final boolean equals(Object arg5) {
        boolean v0 = true;
        if(this != (((BrowserHistory)arg5))) {
            if(arg5 != null && this.getClass() == arg5.getClass()) {
                if(this.icon == ((BrowserHistory)arg5).icon && this.g == ((BrowserHistory)arg5).g && this.h == ((BrowserHistory)arg5).h && (this.url.equals(((BrowserHistory)arg5).url)) && (this.title.equals(((BrowserHistory)arg5).title)) && (this.c.equals(((BrowserHistory)arg5).c))) {
                    return v0;
                }

                return false;
            }

            v0 = false;
        }

        return v0;
    }

    public final int hashCode() {
        int v1 = ((((this.url.hashCode() * 31 + this.title.hashCode()) * 31 + this.c.hashCode()) * 31 + this.icon) * 31 + this.g) * 31;
        int v0 = this.h ? 1 : 0;
        return v0 + v1;
    }

    @NonNull public final String toString() {
        return this.title;
    }
}

